package org.kumas.sgrpc.rpc;

import org.kumas.sgrpc.common.URL;
import org.kumas.sgrpc.common.extension.Adaptive;
import org.kumas.sgrpc.common.extension.SPI;

import static org.kumas.sgrpc.rpc.Constants.PROXY_KEY;

@SPI("JavassistProxyFactory")
public interface ProxyFactory {

    @Adaptive({PROXY_KEY})
    <T> T getProxy(Invoker<T> invoker) throws RpcException;

    @Adaptive({PROXY_KEY})
    <T> T getProxy(Invoker<T> invoker, boolean generic) throws RpcException;

    @Adaptive({PROXY_KEY})
    <T> Invoker<T> getInvoker(T proxy, Class<T> type, URL url) throws RpcException;

}